<?php
declare (strict_types=1);

namespace addons\Builder\driver;

use addons\Builder\facade\Builder;
use addons\Plugin;
use app\common\tool\Result;

class Theme extends Plugin
{
    public function h5()
    {
        return Builder::TableCache()->getView('theme/h5', true, [
            'addons'    => $this->getPlugin('', 3)['data'],
            'installed' => $this->getInstalledTheme()
        ]);
    }

    public function cover()
    {
        return $this->install();
    }


    public function getInstalledTheme()
    {
        $installed = $this->getInstalled();
        foreach ($installed as $item) {
            if ($item['type'] == 3) {
                return $item['key'];
            }
        }
        return 'V2';
    }


}
